<html>

<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <link rel="stylesheet" href="/plugins/jsreport/lib/metro-table.min.css">
    <style>
        body {
            padding: 10px;
        }

        table,
        th,
        td {
            text-align: center;
            vertical-align: middle;
        }

        .table thead th,
        .table tfoot th,
        .table tbody th {
            text-align: center;
        }

        .table thead td,
        .table tfoot td,
        .table tbody td {
            text-align: right;
        }

        .heading {
            font-size: 20px;
        }

        .text-left {
            text-align: left !important;
        }

        .text-center {
            text-align: center;
        }

        .text-right {
            text-align: right;
        }

        .float-right {
            float: right;
        }

        .headtop span.col-1 {
            width: 300px;
            display: inline-block;
        }
    </style>
</head>

<body>
    <div>
        <table class='table table-border row-border cell-border cell-hover striped'>
            <thead>
                <tr class="heading">
                    <th colspan="13">
                        {{filteredReportName user_filters userFilterCompany}}
                    </th>
                </tr>
                <tr class="headtop">
                    <th colspan="13" class="text-left">
                        <span class="col-1">
                            填报单位：{{filteredCompanyName userFilterCompany true}}
                        </span>
                        <span class="col-2">
                            填报单位负责人：
                        </span>
                        <span class="float-right col-3">
                            单位：万元
                        </span>
                    </th>
                </tr>
                <tr>
                    <th rowspan="3">
                        序号
                    </th>
                    <th rowspan="3">
                        合同种类
                    </th>
                    <th colspan="4">
                        正常履行的合同
                    </th>
                    <th colspan="5">
                        履行不正常的合同
                    </th>
                    <th colspan="2" rowspan="2">
                        其中：关联交易合同
                    </th>
                </tr>
                <tr>
                    <th colspan="2">
                        已履行的合同
                    </th>
                    <th colspan="2">
                        尚在履行的合同
                    </th>
                    <th colspan="3">
                        违约但继续履行的合同
                    </th>
                    <th colspan="2">
                        解除的合同
                    </th>
                </tr>
                <tr>
                    <td>
                        份数
                    </td>
                    <td>
                        金额
                    </td>
                    <td>
                        份数
                    </td>
                    <td>
                        金额
                    </td>
                    <td>
                        份数
                    </td>
                    <td>
                        金额
                    </td>
                    <th>
                        违约方
                    </th>
                    <td>
                        份数
                    </td>
                    <td>
                        金额
                    </td>
                    <td>
                        份数
                    </td>
                    <td>
                        金额
                    </td>
                </tr>
            </thead>
            <tbody>
                {{#each contractTypes}}
                <tr>
                    <th>
                        {{rowIndex @index}}
                    </th>
                    <th>
                        {{name}}
                    </th>
                    <td>
                        {{computeContractTypeTagCount _id 'finished' ../result}}
                    </td>
                    <td>
                        {{computeContractTypeTagSum _id 'finished' ../result}}
                    </td>
                    <td>
                        {{computeContractTypeTagCount _id 'pending' ../result}}
                    </td>
                    <td>
                        {{computeContractTypeTagSum _id 'pending' ../result}}
                    </td>
                    <td>
                        {{computeContractTypeTagCount _id 'continue' ../result}}
                    </td>
                    <td>
                        {{computeContractTypeTagSum _id 'continue' ../result}}
                    </td>
                    <td>
                    </td>
                    <td>
                        {{computeContractTypeTagCount _id 'cancel' ../result}}
                    </td>
                    <td>
                        {{computeContractTypeTagSum _id 'cancel' ../result}}
                    </td>
                    <td>
                        {{computeContractTypeTagCount _id 'connected' ../result}}
                    </td>
                    <td>
                        {{computeContractTypeTagSum _id 'connected' ../result}}
                    </td>
                </tr>
                {{/each}}
            </tbody>
            <tfoot>
                <tr class="footer">
                    <th colspan="2">
                        合计
                    </th>
                    <td>
                        {{computeContractTypesTagTotalCount contractTypes 'finished' result}}
                    </td>
                    <td>
                        {{computeContractTypesTagTotalSum contractTypes 'finished' result}}
                    </td>
                    <td>
                        {{computeContractTypesTagTotalCount contractTypes 'pending' result}}
                    </td>
                    <td>
                        {{computeContractTypesTagTotalSum contractTypes 'pending' result}}
                    </td>
                    <td>
                        {{computeContractTypesTagTotalCount contractTypes 'continue' result}}
                    </td>
                    <td>
                        {{computeContractTypesTagTotalSum contractTypes 'continue' result}}
                    </td>
                    <td>
                    </td>
                    <td>
                        {{computeContractTypesTagTotalCount contractTypes 'cancel' result}}
                    </td>
                    <td>
                        {{computeContractTypesTagTotalSum contractTypes 'cancel' result}}
                    </td>
                    <td>
                        {{computeContractTypesTagTotalCount contractTypes 'connected' result}}
                    </td>
                    <td>
                        {{computeContractTypesTagTotalSum contractTypes 'connected' result}}
                    </td>
                </tr>
            </tfoot>
        </table>
    </div>
    <div>
        <div>1. 重大合同{{computeTotalTagCount 'important' result}}份，标的金额{{computeTotalTagSum 'important' result}}万元</div>
        <div>2. 招标合同{{computeTotalTagCount 'bidding' result}}份，标的金额{{computeTotalTagSum 'bidding' result}}万元</div>
        <div>3.
            固定资产合同{{computeTotalTagCount 'solid_investment' result}}份，标的金额{{computeTotalTagSum 'solid_investment' result}}万元
        </div>
        <div>4. 总合同{{computeTotalCount 'solid_investment' result}}份，标的金额{{computeTotalSum 'solid_investment' result}}万元
        </div>
    </div>
</body>

</html>